class LinEditDlg (quarkpy.dlgclasses.LiveEditDlg):
#
# dialog layout
#
endcolor = AQUA
size = (180,200)
dfsep = 0.45
dlgdef = """
{
Style = "9"
Caption = "Linear Mapping Edit Dialog"
scale: =
{
Txt = "Scale"
Typ = "EF003"
Hint = "Scale X, Y, Z dimensions"
}
sep: = {Typ="S" Txt=" "}
angles: =
{
Txt = "Angles"
Typ = "EF003"
Hint = "Pitch, Yaw, Roll angles (rotations around Y, Z, X" $0D " axes, in order"
}
sep: = {Typ="S" Txt=" "}
mirror: = {
Txt = "Mirror"
Typ = "X"
Hint = "Mirror in XZ plane. Mirror effects can also be produced" $0D " with negative scale values"
}
sep: = {Typ="S" Txt=" "}
shear: = {
Txt = "Shear"
Typ = "EF003"
Hint = "Shear angles: Z crunch (toward X axis),"$0D " Y-lift (out of XY plane), Y-twist (from Y-axis orientation)" $0D " For mirror-image, set Y-twist to 180"
}
sep: = { Typ="S" Txt=""}
exit:py = {Txt="" }
}
"""
def macro_linedit(self):
editor = mapeditor()
if editor is None:
quarkx.msgbox('Unfortunately, you need to reselect me in the tree-view',
MT_INFORMATION,MB_OK)
return
sel = editor.layout.explorer.uniquesel
if sel is None:
squawk("very wierd, no selection")
return
class pack:
"just a place to stick stuff"
pack.sel = sel
axes = quarkx.matrix('1 0 0 0 1 0 0 0 1').cols
def setup(self, pack=pack, axes=axes):
pass
src = self.src
sel = pack.sel
linear = sel["linear"]
if linear is None:
linear = '1 0 0 0 1 0 0 0 1'
linear = quarkx.matrix(linear)
pack.linear = linear
cols = linear.cols
#
# get scale
#
src["scale"]=tuple(map(lambda v:abs(v), cols))
cols = tuple(map(lambda v:v.normalized, cols))
#
# get rotations, cols[0] is 'rotated X axis, compute the others